# 用类封装一个MyMath类, 实现加, 减, 乘, 除, 幂, 开方
from math import sqrt


class MyMath(object):
    def add(self, a, b):
        return int(a) + int(b)


    def sub(self, a, b):
        return int(a) - int(b)


    def mul(self, a, b):
        return int(a) * int(b)


    def div(self, a, b):
        return int(a) / int(b)

    def sqrt(self, a):
        return sqrt(a)


# 自由课题, 大家按自己的想法, 将身边的事物抽象出一个类, 并创建多个实例
class p_language(object):
    classification = 'language'
    def __init__(self, obj):
        self.l = obj
        print(f"{self.l}是一种编程语言")


# 创建多个继承作业2父类的子类
class i_language(p_language):
    def __init__(self, obj):
        self.c = obj
        print(f"{self.c}是一种解释型语言")


class c_language(p_language):
    def __init__(self, obj):
        self.c = obj
        print(f"{self.c}是一种编译型语言")


if __name__ == "__main__":
    python = p_language('python')
    go = p_language('go')
    python = i_language('python')
    go = c_language('go')
